//client.cpp
#include "header.h"
int main()
{
    // 1.打开命名管道
    int fd = open(filename, O_WRONLY | O_TRUNC);
    cout<<"client:I have already opened the namefile"<<endl;
    assert(fd != -1);
    // 2.开始通信
    int count = 0;
    while (1)
    {
        char buf[MAX] = {0};
        sprintf(buf, "the client send message is %d", count++);
        cout<<"client:I have already prepared for sending message to the server"<<endl; 
        int ret = write(fd, buf, strlen(buf));
        if (ret <= 0)
        {
            cout << errno << ":" << strerror(errno) << endl;
            break;
        }
        sleep(1);
    }

    return 0;
}